package server;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import common.IAuctionServer;

public class ServerApp {

	public static void main(String args[]) {
		
		try {
			ServerFactory serverFactory = new AuctionServerFactory();
			IAuctionServer server = serverFactory.createServer();
			
			IAuctionServer stub = (IAuctionServer) UnicastRemoteObject.exportObject(server, 0);
			
			Registry registry = LocateRegistry.createRegistry(10778);
			
			registry.bind("Server", stub);
			
			System.out.println("Auction server is ready!");
			
		} 
		catch (Exception e) {
			
			e.printStackTrace();
		}
		
		
	}
}
